﻿using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace TfsComLib.TfsBranchLib2
{
    /// <summary>
    ///     List of branches and list of selected branches, which coould be refreshing from TFS
    /// </summary>
    public interface ISelectedBranchesCache : ISelectedBranches, INotifyPropertyChanged
    {
        ISourceBranches SourceBranchesProvider { get; set; }

        void Refresh();

        event EventHandler OnRefresh;

        /// <summary>
        ///     Find a branch which could be a begining of a newPath.
        /// </summary>
        /// <param name="newPath"></param>
        /// <returns></returns>
        BranchData FindInPath(string newPath);

        /// <summary>
        ///     Find a branch in the list of SourceBranchProvider which could be a begining of a newPath and set it as selected
        /// </summary>
        /// <param name="newPath">Server path started with branch</param>
        /// <param name="selectedBranch">Found branch</param>
        /// <returns>True if find a branch, False otherwise</returns>
        bool SetDefaultBranchForPath(string newPath, out BranchData selectedBranch);

        void SetRecentBranches(List<BranchData> list);

        void DoRefresh();
    }
}